package com.zengjianjun.es.demo.highlevelclient.interceptor;

import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.protocol.HttpContext;

/**
 * @author zengjianjun
 */
@Slf4j
public class ElasticsearchRequestInterceptor implements HttpRequestInterceptor  {

    @Override
    public void process(HttpRequest request, HttpContext context) {
        // 在请求前拦截，打印请求参数
        log.info("Elasticsearch Request: {}", request.getRequestLine());
    }
}
